<?php

namespace app\common\traits;

trait SwiperListPart
{
    public function getSwiperListAttr()
    {
        $value = $this['swiper'] ?? '';
        return explode(',', $value);
    }

    public function setSwiperAttr($value)
    {
        if (is_array($value)) $value = implode(',', $value);
        return $value;
    }

    public function getFullSwiperListAttr()
    {
        $value = $this['swiper'] ?? '';
        $list = array_filter(explode(',', $value));
        foreach ($list as &$item) {
            $item = cdnurl($item, true);
        }
        return $list;
    }
}